<%@ page contentType="text/html; charset=UTF-8"%>
<%@page import="frm.ssh.util.page.SearchBean"%>
<%@ include file="/jsp/common/common.jsp"%>

<html>
	<head>
		<script language="javascript" src="<%=contextPath%>/js/func.js"type=""></script>
			<script type="text/javascript" src="<%=contextPath%>/js/My97DatePicker/WdatePicker.js"></script>
		<script>
			Ext.onReady(function(){
				var tb = new Ext.Toolbar({
			   		renderTo: document.all.tbar,
			    	items: [['->'],
				        {
				            text: '查询',
				            icon:"<%=contextPath%>/images/query.gif",
				            handler:cmt
				        },'-',
				        {
				            text: '增加',
				            icon:"<%=contextPath%>/images/add.gif",
				            handler:function(){
				            	toDetail('0')				            	
				            },
				            hidden:<%=session.getAttribute("btn_add_display") != null || "1".equals(session.getAttribute("SESSION_ISADMIN"))? false:true%>
				        },'-',
				        {
				            text: '停用',
				            icon:"<%=contextPath%>/images/clear.png",
				            handler:recycleIt,
				            hidden:<%=session.getAttribute("btn_recycle_display") != null || "1".equals(session.getAttribute("SESSION_ISADMIN")) ? false:true%>
				        },'-',
				        {
				            text: '删除',
				            icon:"<%=contextPath%>/images/delete.gif",
				            handler:deleteIt,
				            hidden:<%=session.getAttribute("btn_delete_display") != null || "1".equals(session.getAttribute("SESSION_ISADMIN")) ? false:true%>
				        }
			    	]
			    });
			});
		</script>
	</head>
	<body>
		<div id ='tbar'></div>
		<form id="frmM"   name="frmM" method="POST" action="<%=contextPath%>/queryUser.do">

			<s:hidden name="searchBean.con1" />
			
			<table width="100%" id="contab">
				<tr>
					<th>
						用户帐号：
					</th>
					<td>
						<input type="text" name="searchBean.con2" id="searchBean.con2" value="${searchBean.con2}"/>
					</td>
					<th>
						用户名称：
					</th>
					<td>
						<input type="text" name="searchBean.con3" id="searchBean.con3" value="${searchBean.con3}"/>
					</td>
				</tr>
				<tr>
					<th>
						状态：
					</th>
					<td>
						<s:radio name="searchBean.con5" list="#{'':'全部','1':'可用','0':'停用'}" ></s:radio> 
					</td>
					<th></th>
					<td></td>
				</tr>
			</table>
			
			<hr>
			<table width="100%" id="listtab">
				<tr>
					<th   width="25">
						<input name="chkAll" type="checkbox" id="chkAll"
							onclick="javascript:checkAll(this.form, 'id');" value="checkbox">
					</th>
					<th   width="30">员工编号</th>
					<th   width="30">姓名</th>
					<!-- <th   width="200">帐号</th> -->
					<th   width="30">岗位</th>
					<th   width="30">兼职</th>
					<th   width="30">岗级</th>
					<!--<th   width="30">是否白班</th>-->
					<th   width="30">奖金系数</th>
					<th   width="80">参加工作时间</th>
					<!-- <th   width="60">参加运行工作时间</th> -->
					<th   width="60">出生日期</th>
					<th   width="30">手机</th>
					<th   width="55">办公电话</th>
					<th   width="30">状态</th>
					<th   nowrap>角色</th>
				</tr>

				<c:forEach items="${list}" var="detail" >
					<tr>
						<td width="25" >
							<input type="checkbox" name="id" value="${detail.id}" />
						<br></td>
						<td  width="30" ><c:out value="${detail.ygbh}"/><br></td>
						<td  width="50" nowrap="nowrap">
							<a href="#" onClick="javascript:toDetail('<c:out value="${detail.id}"/>')" /><c:out value="${detail.name}"/></a><br>
						</td>
						<td  width="90" ><c:choose>
								<c:when test="${detail.jxkhgw == '001'}">主任</c:when>
								<c:when test="${detail.jxkhgw == '002'}">书记</c:when>
								<c:when test="${detail.jxkhgw == '003'}">副主任</c:when>
								<c:when test="${detail.jxkhgw == '004'}">班组技术员</c:when>
								<c:when test="${detail.jxkhgw == '005'}">班长</c:when>
								<c:when test="${detail.jxkhgw == '006'}">班组安全员</c:when>
								<c:when test="${detail.jxkhgw == '007'}">专工班长</c:when>
								<c:when test="${detail.jxkhgw == '008'}">核算员</c:when>
								<c:when test="${detail.jxkhgw == '009'}">综合事务</c:when>
								<c:when test="${detail.jxkhgw == '010'}">作业手</c:when>
								<c:when test="${detail.jxkhgw == '011'}">副班长</c:when>
								<c:when test="${detail.jxkhgw == '012'}">主责</c:when>
							</c:choose>
							<br></td>
						<td  width="70" >
							<c:choose>
							<c:when test="${detail.jxkhjz == '1'}">班组安全员</c:when>
								<c:when test="${detail.jxkhjz == '2'}">班组技术员</c:when>
								<c:when test="${detail.jxkhjz == '3'}">值班长</c:when>
								<c:when test="${detail.jxkhjz == '4'}">PMS专员</c:when>
									</c:choose><br></td>
						<td  width="30" ><c:choose>
								<c:when test="${detail.jxkhgj == '001'}">8</c:when>
								<c:when test="${detail.jxkhgj == '002'}">10</c:when>
								<c:when test="${detail.jxkhgj == '003'}">11</c:when>
								<c:when test="${detail.jxkhgj == '004'}">12</c:when>
								<c:when test="${detail.jxkhgj == '005'}">13</c:when>
								<c:when test="${detail.jxkhgj == '006'}">16</c:when>
								<c:when test="${detail.jxkhgj == '007'}">17</c:when>
								
							</c:choose><br></td>
						<!-- <td  width="60" ><c:out value="${detail.bkhyy}"/><br></td>-->
						<td  width="30" ><c:choose>
								<c:when test="${detail.jxkhgwjjxs == '001'}">1.66</c:when>
								<c:when test="${detail.jxkhgwjjxs == '002'}">1.79</c:when>
								<c:when test="${detail.jxkhgwjjxs == '003'}">1.94</c:when>
								<c:when test="${detail.jxkhgwjjxs == '004'}">2.11</c:when>
								<c:when test="${detail.jxkhgwjjxs == '005'}">2.27</c:when>
								<c:when test="${detail.jxkhgwjjxs == '006'}">2.84</c:when>
								<c:when test="${detail.jxkhgwjjxs == '007'}">3.05</c:when>
								
							</c:choose><br></td>
						<!--  <td  width="200" ><c:out value="${detail.loginId}"/><br></td>-->
						<td width="80" >
							<fmt:formatDate value="${detail.gzsj}" pattern="yyyy-MM-dd"/>
						</td>
						<!--  <td  width="100">
							<fmt:formatDate value="${detail.yxgzsj}" pattern="yyyy-MM-dd HH:mm"/>
						</td>-->
						<td  width="70" nowrap="nowrap">
							<fmt:formatDate value="${detail.cssj}" pattern="yyyy-MM-dd"/>
						</td>
						<td  width="90" ><c:out value="${detail.mobile}"/><br></td>
						<td  width="60" ><c:out value="${detail.tel}"/><br></td>
						<td   width="30">
							<c:if test="${detail.state==0}">
								<font color='red'>停用</font>
							</c:if>
							<c:if test="${detail.state!=0}">
								<font color='green'>可用</font>
							</c:if>
						<br></td>
						<td>
							<img  style='cursor:pointer' src="<%=contextPath%>/images/user_suit.png" title="点击进行角色设置"
								onClick="javascript:displayModule('<c:out value="${detail.id}"/>')" />
						</td>
					</tr>
				</c:forEach>

				<c:if test="${list == null || fn:length(list) == 0 }">
					<tr>
						<td colspan="15" style="text-align: center">
							无相关记录
						</td>
					</tr>
				</c:if>
			</table>
			<table width="100%" id="tablestyle2">
				<tr>
					<td>
						<hr />
					</td>
				</tr>
				<tr>
					<td>${pageDown}</td>
				</tr>
			</table>
		</form>
	</body>
</html>
<script language="javascript">

			// 查询
			function cmt(){
				document.frmM.action = "<%=contextPath%>/userList!getList.do?page=1&c=c";
				document.frmM.submit();
			}

			// 新建修改进入详细页面
			function toDetail(id){
				document.frmM.action = "<%=contextPath%>/user!initDetail.do?id=" + id;
				uncheck("id");
				document.frmM.submit();
			}
			
			// 删除
			function recycleIt()
			{
				if(!isChecked("id")) {
		 			alert("请选择要停用的用户");
		 			return false;
		 		}
		    	if(confirm("确定要停用选中的用户吗？")) {
		        	document.frmM.action = "<%=contextPath%>/user!recycle.do";
					document.frmM.submit();
		    	}
			}

			// 删除
			function deleteIt()
			{
				if(!isChecked("id")) {
		 			alert("请选择要删除的用户");
		 			return false;
		 		}
		    	if(confirm("确定要删除选中的用户吗？")) {
		        	document.frmM.action = "<%=contextPath%>/user!delete.do";
					document.frmM.submit();
		    	}
			}
			
			// 添加角色
			function displayModule(id)
			{
				var errI=0;
				
         		var url = "<%=contextPath%>/user!getRoleByUserId.do?userId=" + id;// + "&ouid=" + document.frmM.elements["searchBean.con1"].value;
         		
         		var win = openSUB(url,4,550,500,450,30);
         		
         		// = window.open(url,"Result_window2","left=450,top=30,width=550,height=500,status=no,toolbar=no,autoscroll=yes,location=no,menubar=no,resizable=yes",true);
         		/*
         		var isMSIE= (navigator.appName == "Microsoft Internet Explorer"); //判断浏览器 

         		try{
         			if (isMSIE) { 
              			top_id = window.open(url,window,"dialogwidth=450px;dialogheight=400px;help:no;resizable:yes;scrollbars:auto;status:no;toolbar:no");
              		} else {
              			top_id = window.open(url,window,"dialogwidth=450;dialogheight=400;dialogleft=100;dialogtop:50;scrollbars:auto;dialoghelp:no;resizable:no;status:no;toolbar:no");
              		}
         		}
         		catch(err){errI=1;}
         		*/
			}
			
		</script>